<template >
	<view>
		<!-- 我的 -->
		<view v-if="getEnv" class="my">
			<view class="">
				<!-- <my-header></my-header> -->
				<view class="header" :style="{ background: '#f6cf56' }">
					<view class="title">
						<view class="title-left" v-if="!loginStatus">
							<image class="title-left-image" src="../../static/my/my.png" mode=""></image>
							<text @click="JumpLogin">登录</text>
						</view>
						<view class="title-left" v-if="loginStatus" @click="JumpPersonalData">
							<image class="title-left-image" :src="$image + arr.headimg" mode=""></image>
							<!-- <image class="title-left-image" :src="'https://songcan.xyct1688.com/' + arr.headimg" mode=""></image> -->
							<view class="title-left-user">
								<view class="" v-if="arr.nickname != ''">
									{{ arr.nickname }}
								</view>
								<view class="" v-else>
									{{ arr.mobile }}
								</view>
								<view class="">
									{{ arr.point }}
								</view>
							</view>
						</view>
						<view class="title-right" @click="JumpSlgnIn">
							<text class="textFei">分</text>
							签到领积分
						</view>
					</view>
					<view class="footer" :style="{ backgroundImage: 'url(' + RechargeBackImage + ')' }">
						<view class="footer-left">
							<view class="footer-left-title">
								账户充值
							</view>
							<view class="footer-left-footer">
								我的储值：<text>{{ arr.balance }}</text>元
							</view>
						</view>
						<view class="footer-right" @click="RechargeNow">
							立即充值
						</view>
					</view>
				</view>
			</view>
			<view class="main">
				<view class="">
					<invite-com></invite-com>
				</view>
				<!-- 我的服务 -->
				<view class="">
					<my-give-serviceto></my-give-serviceto>
				</view>
				<!-- 入驻服务 -->
				<view class="">
					<residency-services :is_deliveryman="arr.is_deliveryman"></residency-services>
				</view>
				<!-- 系统服务 -->
				<view class="">
					<Services></Services>
				</view>
			</view>
		</view>
		<DeceiveMy v-else></DeceiveMy>
	</view>
</template>

<script>
import DeceiveMy from "@/components/Deceive/DeceiveMy.vue";
import getEnv from "@/utils/getEnv.js";
// import myHeader from "../../components/my/myHeader.vue"
import inviteCom from "../../components/my/inviteCom.vue"
import myGiveServiceto from "../../components/my/MyGiveServiceto.vue"
import ResidencyServices from "../../components/my/ResidencyServices.vue"
import Services from "../../components/my/Services.vue"
const $api = require('@/utils/request.js').API
// const {API:$api,baseURL} = require('@/utils/request.js')
export default {
	components: {
		// myHeader,
		inviteCom,
		myGiveServiceto,
		ResidencyServices,
		Services,
		DeceiveMy
	},
	data() {
		return {
			getEnv: getEnv(),
			RechargeBackImage: require('../../static/my/RechargeBack.png'),
			loginStatus: false,
			userImage: '',
			arr: [],
			$image: this.$image,

		}
	},
	onLoad() {
		// this.postUserInformation()
	},
	onReady() {

	},
	onShow() {
		if (uni.getStorageSync('token')) {
			this.loginStatus = true
			this.postUserInformation()
		} else {
			this.loginStatus = false
			// uni.navigateTo({
			// 	url:'/pages_login/login/login'
			// })
		}
	},
	onShareAppMessage(res) {
		if (res.from === 'button') {// 来自页面内分享按钮

		}
		return {
			title: '校宇通',
			path: '/pages/my/myView'
		}
	},
	onShareTimeline(res) {
		return {
			title: '校宇通',
			path: '/pages/my/myView'
		}
	},
	methods: {
		postUserInformation() {
			$api.postUserInformation({}).then(res => {
				if (res.data.code == 0) {
					this.arr = res.data.data
				}
			})
		},
		// 调转到登录页面
		JumpLogin() {
			uni.navigateTo({
				url: '../../pages_login/login/login'
			})
		},
		// 跳转个人信息
		JumpPersonalData() {
			uni.navigateTo({
				url: '/pages/my/SystemEntry/personalData'
			})
		},
		// 跳转签到
		JumpSlgnIn() {
			uni.navigateTo({
				url: '../../pages/my/signIn/signIn?point=' + this.arr.point
			})
		},
		// 调转到账户充值页面
		RechargeNow() {
			uni.navigateTo({
				url: '../../pages/my/Stored-valueCard/Stored-valueCard'
			})
		}
	}
}
</script>

<style lang="less" scoped>
.my {
	width: 100vw;
	height: 100vh;
	background: #FBFBFB;
	overflow-y: scroll;

	.header {
		position: relative;
		width: 750rpx;
		height: 488rpx;
		// background: url('../../image/my/myHeaderBak.png') no-repeat;
		background-size: 100% 100%;

		.title {
			display: flex;
			justify-content: space-between;
			align-items: center;

			.title-left {
				display: flex;
				align-items: center;
				margin: 202rpx 23rpx;

				.title-left-image {
					width: 126rpx;
					height: 126rpx;
					background: #FFA480;
					border-radius: 50%;
				}

				// 用户信息
				.title-left-user {
					color: white;
					padding-left: 30rpx;

					view:first-child {
						font-size: 30rpx;
						font-weight: 400;
					}

					view:last-child {
						font-size: 24rpx;
						font-weight: 400;
						padding-top: 21rpx;
					}
				}

				text {
					padding-left: 30rpx;
					color: white;
				}
			}

			.title-right {
				display: flex;
				justify-content: center;
				align-items: center;
				width: 191rpx;
				height: 51.8rpx;
				font-size: 21.63rpx;
				color: white;
				text-align: center;
				background: #F14500;
				opacity: 0.71;
				border-radius: 29rpx;
				margin-right: 23rpx;

				.textFei {
					width: 40rpx;
					height: 40rpx;
					font-size: 17.31rpx;

					color: #ABA53C;
					text-align: center;
					line-height: 40rpx;
					display: inline-block;
					border-radius: 50%;
					background: #fecb1c;
					margin-right: 10rpx;
				}
			}

		}

		.footer {
			display: flex;
			justify-content: space-between;
			align-items: center;
			position: absolute;
			left: 4%;
			bottom: 0;
			width: 692rpx;
			height: 141rpx;
			// background: url('../../image/my/RechargeBack.png') no-repeat;
			background-size: 100% 100%;

			.footer-left {
				font-size: 18.66rpx;
				color: white;
				padding-left: 41rpx;

				.footer-left-footer {
					font-size: 32rpx;
					padding-top: 10rpx;
				}
			}

			.footer-right {
				width: 134.7rpx;
				height: 51.8rpx;
				text-align: center;
				line-height: 51.8rpx;
				font-size: 20rpx;
				color: #F7E8C0;
				background: #BC922E;
				margin-right: 26rpx;
				border-radius: 25rpx;
			}
		}
	}

	.main {
		width: 702rpx;
		margin: auto;

		view {
			margin-bottom: 16rpx;
		}
	}
}
</style>